import 'dart:async';
import 'package:bloc/bloc.dart';
import 'package:drm/http/date_result.dart';
import 'package:drm/base/qx_entity.dart';
import './bloc.dart';

class MainBloc extends Bloc<MainEvent, MainState> {
  @override
  MainState get initialState => InitialMainState();

  @override
  Stream<MainState> mapEventToState(
    MainEvent event,
  ) async* {
    if (event is MainGetQxEvent) {
      print('bloc 接收到事件');
      DateResult<List<QxEntity>> result = await event.getQxList();
      print('bloc 请求结束');
      yield MainGetQxEventState(result);
    }
  }
}
